/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uit.jee.lib.access.mapper;

import java.sql.Connection;
import uit.jee.lib.communication.database.ConnectionServer;

/**
 *
 * @author Ultimate
 */
public class MapperDB {
     private static Connection connection;
     
     public MapperDB()throws Exception{
         try{
             if(connection == null)
                 connection = ConnectionServer.getConnection();
         }catch(Exception e){
             System.out.println(e.toString());
             throw e;
         }
     }
     
     public Connection getConnection(){
         return connection;
     }

     public void closeConnection() throws Exception{
         try{
             getConnection().close();
         }catch(Exception e){
             System.out.println(e.toString());
             throw e;
         }
     }
}
